<template>
  <Dialog
    v-model="dialogVisible"
    width="800px"
    title="导入结果"
    :before-close="() => closeDialog()"
  >
    <div class="flex flex-col">
      <div class="flex flex-items-center" v-for="item in dataList" :key="item.row">
        <div>{{ `第${item.row}行：` }}</div>
        <div>{{ item.info }}</div>
      </div>
    </div>
    <template #footer>
      <el-button class="m-r-4" @click="closeDialog">关闭</el-button>
    </template>
  </Dialog>
</template>
<script setup lang="ts">
import { Dialog } from '@/components/Dialog'

const emit = defineEmits(['refresh'])

const dialogVisible = ref<boolean>(false)

const dataList = ref<Array<Record<string, any>>>([])

const closeDialog = () => {
  dataList.value = []
  dialogVisible.value = false
}

const getBackShow = (row: Record<string, any>) => {
  const data = JSON.parse(JSON.stringify(row))
  data.uploadFile && delete data.uploadFile
  if (!Reflect.ownKeys(data).length) return
  dataList.value = data
}

defineExpose({
  dialogVisible,
  getBackShow
})
</script>
<style lang="less" scoped></style>
